﻿using System;
using System.Collections.Generic;
using System.Web.UI.WebControls;
using Ue.Infrastructure.Web.UI;
using Ue.Qcdz.Domain.feedbacks;

namespace Ue.Qcdz.UI.Controls.Feedbacks
{
    public class FeedBackView : SkinnedGridView
    {
        private string skinFileName = "~/Themes/zh-cn/Skins/FeedBacks/FedBackView.ascx";
        #region Overrides of SkinnedControl


        public bool IsComm { get; set; }
        protected override string GetSkinFileName()
        {
            return skinFileName;
        }

        #endregion

        #region Overrides of SkinnedGridView

        protected override void GridViewDataBind(object sender, EventArgs args)
        {
            string shopid = null;
            if(!string.IsNullOrEmpty(this.Page.Request["shopid"]))
            {
                 shopid = this.Page.Request["shopid"].ToLower();
            }
            else if(IsComm)
            {
                shopid = "comm";
            }
            IFeedBackRepository repository =
                          Ue.Infrastructure.RepositoryFramework.RepositoryFactory.GetRepository
                              <IFeedBackRepository, Ue.Qcdz.Domain.feedbacks.Feedback>();
                IList<Feedback> list = (IList<Feedback>)repository.FindBy(shopid);
                Repeater repeater = sender as Repeater;
                repeater.DataSource = list;
                repeater.DataBind();
            
            
        }

        #endregion
    }
}
